package com.itcast.demo.controller;

import com.alibaba.fastjson.JSON;
import com.itcast.demo.entity.Person;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author tyy
 * @Description TODO
 * @Since 2022/1/31
 */
@RestController// 数据接口不是页面跳转接口
@RequestMapping("demo")// 可以去掉
@Slf4j
public class DemoController {
    @RequestMapping("demo")
    public String demo() {
        return "demo====Hello World!!";
    }
    @RequestMapping("demo2")
    public String demo2(@RequestBody Person person) {
        log.info("person:{}", JSON.toJSONString(person));
        return "demo2====Hello World!!";
    }
}
